package org.pine.start.interceptor;

import net.sf.jsqlparser.expression.Expression;
import org.pine.common.annotation.DataPermission;
import org.pine.common.enums.DbDataScopeEnum;
import org.springframework.stereotype.Component;

/**
 * 处理所有数据权限范围
 *
 * @author pine manage
 * @since 2024-09-26
 */
@Component
public class ProcessAllDataScopeListener implements ProcessWhereExpressionListener {

    /**
     * 处理where条件
     *
     * @param where where
     */
    @Override
    public Expression process(Expression where, DataPermission dataPermission, String mainTableName) {
        // do nothing
        return where;
    }

    /**
     * 获取数据权限范围
     *
     * @return 数据权限范围
     */
    @Override
    public DbDataScopeEnum getDataScope() {
        return DbDataScopeEnum.ALL;
    }
}
